package com.siteseat.common.deploy;

import java.io.File;
import java.util.Arrays;

public class DeployEntry {

  private File file;
  
  private String filePath;
  
  private byte[] digest;
  
  private Object data;


  /**
   *
   *
   */
  public DeployEntry() {
  }
  

  /**
   *
   *
   * @param file
   * @param filePath
   * @param digest
   * @param data
   */
  public DeployEntry(File file, String filePath, byte[] digest, Object data) {
    this.file = file;
    this.filePath = filePath;
    this.digest = digest;
    this.data = data;
  }
  

  /**
   *
   *
   * @param file
   * @param filePath
   * @param digest
   * @param data
   */
  public DeployEntry(File file, String filePath, byte[] digest) {
    this( file, filePath, digest, null );
  }
  
  
  /**
   * {@inheritDoc}
   */
  @Override
  public String toString() {
    return getFilePath();
  }

  /**
   * Gets the file
   *
   * @return the file
   */
  public File getFile() {
    return file;
  }

  /**
   * Sets the file
   *
   * @param file the file to set
   */
  public void setFile(File file) {
    this.file = file;
  }

  /**
   * Gets the filePath
   *
   * @return the filePath
   */
  public String getFilePath() {
    return filePath;
  }

  /**
   * Sets the filePath
   *
   * @param filePath the filePath to set
   */
  public void setFilePath(String filePath) {
    this.filePath = filePath;
  }

  /**
   * Gets the digest
   *
   * @return the digest
   */
  public byte[] getDigest() {
    return digest;
  }

  /**
   * Sets the digest
   *
   * @param digest the digest to set
   */
  public void setDigest(byte[] digest) {
    this.digest = digest;
  }
  
  /**
   * 
   *
   * @param thatDigest
   * @return
   */
  public boolean isSameDigest(byte[] thatDigest) {
    return Arrays.equals( getDigest(), thatDigest );
  }

  /**
   * Gets the data
   *
   * @return the data
   */
  public Object getData() {
    return data;
  }

  /**
   * Sets the data
   *
   * @param data the data to set
   */
  public void setData(Object data) {
    this.data = data;
  }
  
}
